//
//  MJNetWorkTool.h
//  MJ
//
//  Created by lina on 2017/11/30.
//  Copyright © 2017年 lina. All rights reserved.
//

#import <Foundation/Foundation.h>

#pragma mark 网络请求类型
enum HTTPMETHOD{
    
    METHOD_GET   = 0,    //GET请求
    METHOD_POST  = 1,    //POST请求
};

enum DOWNLOADTYPE{
    
    DOWNLOAD_DEFAULT    = 0,    //默认下载位置
    DOWNLOAD_VOICE      = 1,    //配音文件下载
};

/*!
 *  方便管理请求任务。执行取消，暂停，继续等任务.
 *  - (void)cancel，取消任务
 *  - (void)suspend，暂停任务
 *  - (void)resume，继续任务
 */
typedef NSURLSessionTask CH2URLSessionTask;

@interface MJNetWorkTool : NSObject

/**
 *  类方法
 */
+ (MJNetWorkTool *)sharedUtil;

/**
 * AF数据请求-JSON
 */
- (void)requestAFURL:(NSString *)URLString httpMethod:(NSInteger)method parameters:(NSMutableDictionary *)parameters succeed:(void (^)(id dict))succeed failure:(void (^)(NSError *err))failure;


- (void)requestAFURL:(NSString *)URLString
          parameters:(id)parameters
            fileName:(NSString *)imagePath
             succeed:(void (^)(id))succeed
             failure:(void (^)(NSError *))failure;

@end
